import { CellRenderer } from "../../../../../fl/controls/listClasses/CellRenderer";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { SPublicMiniPlayer } from "../../../../../Message/Public/SPublicMiniPlayer";
import { PlayerUtil } from "../../common/util/PlayerUtil";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class MarryGuestRequestCell
    
    export  class MarryGuestRequestCell extends CellRenderer
    {
        constructor()
        {
            super();
            this.mouseChildren = true;
            this.initStyles();
            this.create();
            return;
        }

        /* internal  */initStyles(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("overSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap("Friend_over"));
            return;
        }

        /* internal  */create(): void
        {
            var loc1=GlobalStyle.textFormat1;
            loc1.align = flash.text.TextFormatAlign.CENTER;
            this._tfName = ObjCreate.createTextField("", 0, 5, 100, 20, this, loc1);
            this._tfLevel = ObjCreate.createTextField("", 100, 5, 70, 20, this, loc1);
            this._tfCamp = ObjCreate.createTextField("", 170, 5, 80, 20, this, loc1);
            this._btnInvite = ObjCreate.createGButton(Language.getString(43603), 250, 3, 52, 22, this);
            this._btnRefuse = ObjCreate.createGButton(Language.getString(43604), 310, 3, 52, 22, this);
            this._btnInvite.drawNow();
            this._btnRefuse.drawNow();
            this._btnInvite.addEventListener(flash.events.MouseEvent.CLICK, this.onInviteClick);
            this._btnRefuse.addEventListener(flash.events.MouseEvent.CLICK, this.onRefuseClick);
            return;
        }

        /* internal  */onInviteClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.MarryAgreeGuestApply, this._player));
            return;
        }

        /* internal  */onRefuseClick(arg1: Object /* flash.events.MouseEvent */): void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.MarryRefuseGuestApply, this._player));
            return;
        }

        public /* override */ set label(arg1: string)
        {
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "spublicminiplayer") 
            {
                this._player = arg1 as SPublicMiniPlayer;
                this.updateView();
                this.drawNow();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            this._tfName.text = this._player.name;
            this._tfLevel.text = this._player.level.toString();
            this._tfCamp.htmlText = PlayerUtil.getCampHtml(this._player.camp);
            return;
        }

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfLevel: Object /* flash.text.TextField */;

        /* internal */ /* var */_tfCamp: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnInvite: GButton;

        /* internal */ /* var */_btnRefuse: GButton;

        /* internal */ /* var */_player: SPublicMiniPlayer;
    }
